package com.jcx.ldzj.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jetbrains.annotations.NotNull;

import java.io.Serializable;
import java.util.List;
/**
 * 业精于勤荒于嬉，行成于思毁于随！
 * @author ld
 * @since 2021-07-14
 */
@Data
@TableName("sys_menu")
@ApiModel(value="SysMenu对象", description="")
public class SysMenu implements Serializable, Comparable<SysMenu> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "菜单id")
    @TableId(value="menu_id_",type = IdType.AUTO)
    private Long menuId;

    @ApiModelProperty(value = "菜单名称")
    @TableField("menu_name_")
    private String menuName;

    @ApiModelProperty(value = "父id")
    @TableField("parent_id_")
    private Long parentId;

    @ApiModelProperty(value = "子节点")
    @TableField(exist = false)
    private List<SysMenu> chrilds;

    @ApiModelProperty(value = "显示顺序")
    @TableField("order_num_")
    private Integer orderNum;

    @ApiModelProperty(value = "路由地址")
    @TableField("menu_path_")
    private String menuPath;

    @ApiModelProperty(value = "组件路径")
    @TableField("component_")
    private String component;

    @ApiModelProperty(value = "1、目录2、菜单3、按钮")
    @TableField("judge_")
    private Character judge;

    @ApiModelProperty(value = "权限")
    @TableField("permissions_")
    private String permissions;

    @ApiModelProperty(value = "是否显示")
    @TableField("effective_")
    private Character effective;

    @ApiModelProperty(value = "状态")
    @TableField("state_")
    private Character state;

    @ApiModelProperty(value = "外部地址")
    @TableField("external_address_")
    private String externalAddress;


    @ApiModelProperty(value = "外部地址")
    @TableField("whe_ther_")
    private String wheTher;

    @Override
    public String toString() {
        return "SysMenu{" +
                "menuId=" + menuId +
                ", menuName='" + menuName + '\'' +
                ", parentId=" + parentId +
                ", chrilds=" + chrilds +
                ", orderNum=" + orderNum +
                ", menuPath='" + menuPath + '\'' +
                ", component='" + component + '\'' +
                ", judge=" + judge +
                ", permissions='" + permissions + '\'' +
                ", effective=" + effective +
                ", state=" + state +
                ", externalAddress='" + externalAddress + '\'' +
                ", wheTher='" + wheTher + '\'' +
                '}';
    }

    @Override
    public int compareTo(@NotNull SysMenu o) {
        return this.orderNum.compareTo(o.getOrderNum());
    }
}
